﻿using System.Threading;

namespace UtilZ.Dotnet.Ex.Base
{
    /// <summary>
    /// 线程参数
    /// </summary>
    public sealed class ThreadPara : CancellationTokenEx
    {
        /// <summary>
        /// 所属线程
        /// </summary>
        public ThreadEx OwnerThread { get; private set; }

        /// <summary>
        /// 当前执行的线程项
        /// </summary>
        public ThreadItem ThreadItem { get; private set; }

        /// <summary>
        /// 参数
        /// </summary>
        public object Para { get; private set; }

        /// <summary>
        /// 线程初始化数据
        /// </summary>
        public object Data { get; private set; }

        /// <summary>
        /// 构造函数
        /// </summary>
        /// <param name="thread">所属线程</param>
        /// <param name="threadItem">当前执行的线程项</param>
        /// <param name="token">CancellationToken</param>
        /// <param name="para">参数</param>
        /// <param name="data">线程初始化数据</param>
        public ThreadPara(ThreadEx thread, ThreadItem threadItem, CancellationToken token, object para, object data)
            : base(token)
        {
            this.OwnerThread = thread;
            this.ThreadItem = threadItem;
            this.Para = para;
            this.Data = data;
        }
    }
}
